* creative occupations crosswalks for SOC00 and SOC90


// 35 creative occupations in SOC2000
global CreatOcc00  1134, 3433, 3543, 2431, 2432, 3121, 5491, 5492, ///
 5493, 5494, 5495, 5496, 5499, 8112, 9121, 2126, 3411, 3421, 3422, 5411, 3434, 3412, /// 
 3413, 3414, 3415, 3416, 3431, 5421, 5422, 5423, 5424, 1136, 2131, 3432, 5244

 
 
 
* age 46 and age 50 data
use scratchdata/ncds_2008_flatfile.dta, clear
merge 1:1 NCDSID using  scratchdata/ncds_2004_flatfile.dta
keep NCDSID soc* 
reshape long soc90_I soc00_I, i(NCDSID) j(age)
rename soc90* soc90
rename soc00* soc00
keep if soc00!=. & soc90!=.

// creative occupations in SOC2000
gen pCreat00 = 0
foreach val of global CreatOcc00 {
    replace pCreat00= 1 if soc00 == `val'
	
}

replace pCreat00 = 0.05 if soc00==9121

// Fraction of SOC90 code in creative occupation in 2000
bys soc90: ge N90 = _N
bys soc90: egen nCreat90=sum(pCreat00)
ge pCreat90=nCreat90/N90
drop nCreat90 N90

keep soc90 soc00 pCreat00 pCreat90

preserve
keep soc90 pCreat90
duplicates drop
save scratchdata/CreativeOcc90.dta, replace
restore

preserve
keep soc00 pCreat00
duplicates drop
save scratchdata/CreativeOcc00.dta, replace
restore
